<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>禅疗堂管理系统</title>
<link rel="stylesheet" href="../../css/ecp.min.css" />
<link rel="shortcut icon" href="../../favicon.ico" type="image/x-icon" />
 <style>
tr:hover{
	cursor:default;
}
.search_table input.qryInput{
	width:138px;
	height:23px;
	line-height:23px;
	padding: 0 3px;
}
.tab-border{border:1px solid #edeeee;border-radius:2px;table-layout: fixed;}
.tab-border tbody tr:hover td{padding: 3px 4px 3px;}
#J_tabletpl td{border: 1px solid #edeeee;word-break:keep-all;overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis}
#titleReport th{border: 1px solid #edeeee;}
.text_over_flow{width:100px; white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
/* .text_over_flow:hover{overflow: visible; } */
.text_over_flow_no_width{width:70px;height:20px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;word-wrap:normal;}
.width150{width: 150px;}
.selWid150{width:160px;}
.ui-dialog-body{padding:5px}
.ui-dialog-content{overflow-y:auto;}
.width130{width:130px;}
.search_table tr{line-height:32px;}
.lang_cntt_stl{word-break:break-all;}
.ui-menu_stl{

}
.ui-menu_stl li{
    margin-right:40px;
}
.li_stl{position: relative;display: inline-block;}
.li_stl .second_menu_tabs{
        height: 60px;
    width: 200px;
}
.second_menu_tabs:hover{cursor: pointer;}
.li_stl .secd_menu{
    height:60px;
    float:left;
}
.li_stl .secd_menu_pic{
    width:60px;
}
.li_stl .secd_menu_txt{
    width:90px;
    height:60px;
    line-height:60px;
}
.li_stl .secd_menu_check{background:aliceblue; }
</style>
<style>
    .ui-dialog-body{overflow:auto;}
    .ui-dialog-body{padding:10px}
    .ui-dialog-content{overflow-y:auto;overflow-x:hidden}
</style>
</head>
<body>
<body>
  <section class="wrap-full">
	   <div class="listTopBtn">
    	<table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><h1>用户报名管理</h1></td>
          </tr>
        </table>
    </div>
    <div>
        <div class="tabsArea fn-clear">

        </div>
    </div>
	<div class="cmxform">
		<form
			class="record-search-form record-search-min record-search-form-border"
			id="J_formSearch" name="J_formSearch">
			<div class="record-search-cate">
				<table class="search_table" cellpadding="0" cellspacing="0" border="0" width="100%">
				 <tr class='hide_row'>
				    <td width="80">
                       <label class="description">姓名</label>
                    </td>
                    <td width="200">
                        <input type="text" name="userNm" id="userNm"/>
                    </td>
                    <td class="td-last-child">
                    	<a class="searchBtn" href="javascript:;" id="J_search"><i></i>查询</a>
               		</td>
				 </tr>
			</table>
			</div>
		</form>
	</div>
	<div>
</div>
</section>

<div class="listTopBtn">
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td>
					<div class="normalBtnArea ta_l">
						<h2></h2>
					</div>
				</td>
				<td>
				     <a class="smallBtn BGblue" href="javascript:void(0);" id="" onclick="addEnrollInfo();">新增</a>
				     <a class="smallBtn BGblue" href="javascript:void(0);" id="" onclick="editEnrollInfo();">编辑</a>
                    <a class="smallBtn BGblue" href="javascript:void(0);" id="" onclick="delEnrollInfo();">删除</a>
				</td>
			</tr>
		</table>
	</div>
	
<section>
<div class="tablewidth mg_t_10" id="titleReport">
	 <table class="ui-record-table table_radius tab-border table-striped mg_t_42" width="100%">
        <thead id ="J_tableTile">   
        <tr>
            <th width="35">选择</th>
            <th width="100">姓名</th>
            <th width="120">电话</th>
            <th width="100">地址</th> 
            <th width="100">推荐人</th>
            <th width="100">报名类型</th>
            <th width="100">报名会议</th>                 
          </tr>       
        </thead>
        <tbody id="J_tabletpl"></tbody>
        </table>      
        	
      </div>
      <!-- <div style="height:100px"></div> -->
    </section>  
    <!--翻页及功能按钮区域开始-->
    <DIV class="amount-bottom" >
        <table width="100%" border="0" cellspacing="0" cellpadding="0" class="gridBottom">
          <tr>
			<td class="ta_l">
             </td>
            <td width="50%">
                <DIV class="fn-clear action-other  action-other-show ">
                        <DIV id="pagination" class="page pagination fn-right"></DIV>
                        <DIV class="fn-right fn-pt5 fn-pr10"></DIV>
                </DIV></td>
          </tr>
        </table>
    </DIV>
    <!-- 报名信息详情 -->
    <div id="enrollDtlWin" class="fn-hide">
      <table class="form_table" width="95%"> 
       <tbody id="table_tbody"> 
       <tr>
            <td width="130">
                 <label class="description"> 姓名:</label>
            </td>
            <td colspan="3"><span id="userNmD"></span></td>            
        </tr> 
        <tr>            
            <td>
                 <label class="description">地址：</label>
            </td>
            <td colspan="3"><span id="enrollAddrD"></span></td>
        </tr>
        <tr>
        	<td>
                 <label class="description">联系电话：</label>
            </td>
            <td colspan="3"><span id="userTelnumD"></span></td>
        </tr>
        <tr>
        	<td>
                 <label class="description">微信：</label>
            </td>
            <td><span id="userWeixinD"></span></td>
            <td>
                 <label class="description">QQ：</label>
            </td>
            <td><span id="userQQD"></span></td>
        </tr>       
        <tr>
        	<td>
                 <label class="description">报名类型：</label>
            </td>
            <td><span id="enrollTypeCdD"></span></td>
            <td>
                 <label class="description">报名会议：</label>
            </td>
            <td><span id="meetNmD"></span></td>
        </tr>
        <tr>
        	<td>
                 <label class="description">推荐人：</label>
            </td>
            <td><span id="introducerPsnD"></span></td>
            <td>
                 <label class="description">推荐人电话：</label>
            </td>
            <td><span id="introducerTelnumD"></span></td>
        </tr>
        <tr>
	        <td>
	            <label class="description">需求介绍：</label>
	        </td>
	        <td colspan="3"><div id="enrollDescD" class="lang_cntt_stl"></div></td>
       </tr>       
       </tbody> 
      </table> 
    </div>
    <!-- 新增、编辑弹框  -->
    <iframe id="AddAndEditIframe" class="iframePop" width="100%" height="0" frameborder="0" scrolling="no" src=""></iframe>
    
	<script id="T_tabletpl" type="text/x-handlebars-template">
	{{#if beans}}
	  {{#each beans}}
        <tr>
            <td width="25" align="center"><input type="checkbox" attr_enrollId="{{enrollId}}" value="{{enrollId}}"/></td>
			<td width="100"><a href="javascript:void(0);" onclick ="companyDtlWin('{{enrollId}}');">{{userNm}}</a></td>
            <td width="100">{{userTelnum}}</td>
            <td width="100">{{enrollAddr}}</td>
			<td width="100">{{introducerPsn}}</td>
            <td width="100">{{enrollTypeCdNm enrollTypeCd}}</td>
			<td width="100">{{meetNm}}</td>
        </tr>		
	  {{/each}}	
	{{else}}
	<tr>
		<td colspan="7">
			<div class="ui-tips-box a">
				<div class="ui-icon-noData"></div>
				<div class="ui-tips-text">暂无数据记录！</div>
			</div>
		</td>
	</tr>
    {{/if}}
	</script>

	<!--
************************************
 请依据项目情况引用公用JS文件，如#include "../../tpl/res_js.tpl" 
 ************************************ 
 -->
<script src="../../js/lib.min.js"></script>
<script src="../../js/requirejsConfigObj.js"></script>
<script src="../../js/requirejs/2.1.17.js"></script>
<script src="../../js/common.min.js"></script>
	<script type="text/javascript">
	var G_params = {
			url : '/getEnrollList',
			items_per_page : 10,   		// 每页数     @param : limit
			page_index : 0 , 
			pagination: "pagination", //分页id
			searchformId : "J_formSearch", //搜索表单的id
			tabletpl : "T_tabletpl", //表格模板
			tablewrap : "J_tabletpl" //表格容器
		};
	$(function(){
		inint();
	})
	$('#J_search').on('click',function() {
		inint();
	});
	function inint(){
		var str = $("#" + G_params.searchformId).serialize(); //把form序列化
		Util.pagination(0, true,G_params, str);
	}
	function addEnrollInfo(){
		var params = {winFlag:"1003"};
		addAndEditDialog(params);
	}
	function editEnrollInfo(){
		var checkedObj = $("#J_tabletpl tr td:nth-child(1)").find("input:checked");
    	if(checkedObj.length > 0){
	    	if(checkedObj.length > 1){
	             Util.dialog.tips("只能选择一条信息进行编辑");
	             return;
	    	}else{
	    		var enrollId = checkedObj.attr('attr_enrollId');
	    		var params = {winFlag:"1004",'enrollId':enrollId};
	    		addAndEditDialog(params); 
	    	}
    	}else{
    		Util.dialog.tips("请选择一条信息进行编辑");
    		return;
    	}
	}
	function delEnrollInfo(){
		var checkedObj = $("#J_tabletpl tr td:nth-child(1)").find("input:checked");
    	if(checkedObj.length > 0){
	    	if(checkedObj.length > 1){
	             Util.dialog.tips("只能选择一条信息进行删除");
	             return;
	    	}else{
	    		var enrollId = checkedObj.attr('attr_enrollId');
	    		var param={'enrollId':enrollId};
	              var msgDel = {
	                    id: 'publishConfirm', //弹出对话框的id
	                    title: '提示信息', //左上角提示标题
	                    content: '确认要删除吗？', //具体提示内容
	                    okVal: '确定', //确认按钮文本
	                    okCallback: function() { //确认按钮点击过之后执行的函数
	                      Util.ajax.postJsonSync('/delEnrollInfo', param, function(json,status){
	                          if(status){
	                              Util.dialog.tips("删除成功");
	                              inint();//异步刷新页面数据
	                          }else{
	                              Util.dialog.tips("删除失败,请重试");
	                          }
	                      });
	                    },
	                    cancelVal: '取消', //取消按钮文本
	                    cancelCallback: function() {} //取消按钮点击后执行的函数
	                };
	                Util.dialog.confirm(msgDel);
	    	}
    	}else{
    		Util.dialog.tips("请选择一条信息进行删除");
    		return;
    	}
	}
	Handlebars.registerHelper("enrollTypeCdNm",function(value){
        if(value=='1001'){
           return "招商加盟会";
        }else if(value=='1002'){
           return "禅修会议";
        }else if(value=='1003'){
        	return "加盟商培训";
        }else{
           return "其他";
        }
  	});
	function addAndEditDialog(params){
        var addAndEditIframe = document.getElementById('AddAndEditIframe');
        var addAndEditTitle = "";
        var src = "";
        var winFlag = params.winFlag;
        if(winFlag == '1003'){
            addAndEditTitle = "新增报名";
            src = "addEnrollInfo.html";
        }else if(winFlag == '1004'){
            addAndEditTitle = "编辑报名";
            src = "editEnrollInfo.html?enrollId="+params.enrollId;
        }
        var addAndEditframeDiv = {
            id : 'D_addAndEditIframe',
            title : addAndEditTitle,
            content : addAndEditIframe,
            width: '950', //对话框宽度
            height: '500', //对话框高度
            modal: true,
            closeCallback : function(){
                closeIframeDialog();
            }
        };
        Util.loading.create('body',"正在加载，请稍候。。。"); 
        Util.dialog.openDiv(addAndEditframeDiv);
        $('.ui-dialog-content').css('overflow-y','auto');
        setDialogTitle(addAndEditTitle);
        Util.loading.close('body');
        $('#AddAndEditIframe').attr('src',src);
        //ie
         if (addAndEditIframe.attachEvent) {      
            addAndEditIframe.attachEvent("onload", function() {      
                setIframeHeight();   
             });      
         } else {      
             addAndEditIframe.onload = function() {      
                 setIframeHeight();
             };      
         }      
    }
    //   设置iframe弹框高度，子页面可调用
    function setIframeHeight(){
        $("#AddAndEditIframe").height($("#AddAndEditIframe").contents().find("body").height() + 120); 
    }
    //关闭弹框，子页面可调用
    function closeIframeDialog(){
        Util.dialog.close("D_addAndEditIframe");
        $(".iframePop").height(0);
        $(".iframePop").html("");
        $(".iframePop").attr("src","");
    } 
    function setDialogTitle(title){
        if($(".ui-dialog-title").attr("id") == "title:D_addAndEditIframe"){
            $(".ui-dialog-title").html(title);
        }
    }
    function setTip(str,lvl,times){
        Util.dialog.tips(str,top,2000);
    }
  
     function isDataNull(str) {
         if (str == null || str == "" || str == undefined) {
             return true;
         }
         return false;
     }
     
     var companyDtlW = document.getElementById('enrollDtlWin');
     var _dialogUnit = null;
     var showDialogCompanyDtl = function() {
         var paramsCompanyDtl = {
           id: 'D_company_dtl', //弹出对话框的id
           title: '报名人员详情', //左上角提示标题
           content: companyDtlW, //具体提示内容
           width: '900', //对话框宽度
           height: '400', //对话框高度
           modal: true
         };
         _dialogUnit = Util.dialog.openDiv(paramsCompanyDtl);
    };
    
     //详情弹框
     function companyDtlWin(enrollId){
    	 $("#userNmD").text("");
         $("#enrollAddrD").text("");
         $("#userTelnumD").text("");
         $("#userQQD").text("");
         $("#userWeixinD").text("");
         $("#enrollTypeCdD").text("");      
         $("#enrollDescD").text("");      
         $("#introducerPsnD").text("");    
         $("#introducerTelnumD").text(""); 
         $("#meetNmD").text("");   
         showDialogCompanyDtl();
    	 var param = {enrollId:enrollId};   
    	 Util.ajax.postJsonSync('/getEnrollDtlInfo', param, function(json,status){
             var obj = json.bean;
             if(status){
            	 $("#userNmD").text(obj.userNm);
                 $("#enrollAddrD").text(obj.enrollAddr);
                 $("#userTelnumD").text(obj.userTelnum);
                 $("#userQQD").text(obj.userQq);
                 $("#userWeixinD").text(obj.userWeixin);
                 var enrollTypeCd = obj.enrollTypeCd;
                 var strNm = "";
                 if(enrollTypeCd=='1001'){
                	 strNm = "招商加盟会";
                  }else if(enrollTypeCd=='1002'){
                	  strNm = "禅修会议";
                  }else if(enrollTypeCd=='1003'){
                	  strNm = "加盟商培训";
                  }else{
                	  strNm = "其他";
                  }
                 $("#enrollTypeCdD").text(strNm);      
                 $("#enrollDescD").text(obj.enrollDesc);   
                 $("#meetNmD").text(obj.meetNm);  
                 $("#introducerPsnD").text(obj.introducerPsn);    
                 $("#introducerTelnumD").text(obj.introducerTelnum);                   	
             }else{
                 Util.dialog.tips("查询失败,请重试");
             }
    	 });
     }
	</script>
</body>
</html>
